<template>
  <p>组件传值: {{ num }}</p>
  <button @click="callback">调用父方法</button>
  <p>子组件自己的值: {{ age }}</p>
</template>

<script setup>
import { onMounted, ref, useAttrs, useSlots, getCurrentInstance } from "vue";

let age = ref(27);

const props = defineProps({
  num: {
    type: Number,
    default: 0,
  },
});

const emit = defineEmits(["fun"]);

const callback = () => {
  emit("fun", 123);
};

defineExpose({ age });

const attr = useAttrs();
const slots = useSlots();
onMounted(() => {
  console.log(attr);
  console.log(slots);
  const { ctx } = getCurrentInstance();
  console.log(ctx.$customize)
});
</script>

<style>
</style>